{% extends "base.html" %} 

{% block header %}
<script src="/static/js/jquery-3.2.1.min.js"></script> 
<script src="/static/js/jquery-2.1.4.min.js"></script> 
<script src="/static/js/jquery.form.js"></script> 
<script src="/static/js/bootstrap.min.js"></script> 
{% endblock%}

{% block content %}
<!-- <div class="wrapper wrapper-content animated fadeInRight"> -->
<div>
    <h1 id="grp-admin-title">{% autoescape off %}ansible临时任务名为【{{ report_data.name }}】的执行报告{% endautoescape %}</h1>

    {% if error_message %}
    <div class="alert alert-danger text-center">{{ error_message }}</div>
    {% endif %}
    
    <h2 id="grp-admin-title">基本信息</h2>
    <table class="table table-striped table-bordered table-hover">
        <tbody>
            {% autoescape off %}
            <tr>
                <td>uuid</td>
                <td>{{ report_data.uuid }}</td>
            </tr>
        
            <tr>
                <td>开始时间</td>
                <td>{{ report_data.create_time }}</td>
            </tr>
            
            <tr>
                <td>结束时间</td>
                <td>{{ report_data.end_time }}</td>
            </tr>
            
            <tr>
                <td>执行时长</td>
                <td>{{ report_data.duration }}秒</td>
            </tr>
            
            <tr>
                <td>主机组</td>
                <td>{{ report_data.pattern }}</td>
            </tr>
            
            <tr>
                <td>模块名</td>
                <td>{{ report_data.module_name }}</td>
            </tr>
            
            <tr>
                <td>参数</td>
                <td>{{ report_data.module_args }}</td>
            </tr>
            
            <tr>
                <td>说明</td>
                <td>{{ report_data.describe }}</td>
            </tr>
            {% endautoescape %}
        </tbody>
    </table>
        
    <h2 id="grp-admin-title">任务执行结果</h2>     
    <table class="table table-striped table-bordered table-hover">
        <tbody>
            {% for hosts , content in report_data.exec_result.items %}
            <tr>
                
                {% autoescape off %}
                <td>{{ hosts }}</td>
                {% endautoescape %}
                
                <td>
                {% if not content %}
                正在执行中，请点击<a href="/ansible/report/detail?uuid={{ report_data.uuid }}&mode={{ report_data.mode }}&force=True"><button type="button" class="btn btn-sm btn-primary" >强制刷新</button></a>
                {% else %}
                <table class="table table-striped table-bordered table-hover">
                {% for title , value in content.items %}
		        <tbody>
		            <tr>
		                {% autoescape off %}
		                <td>{{ title }}</td>
		                {% endautoescape %}
	
		                {% autoescape off %}
		                {% if value %}
		                <td>{{ value }}</td>
		                {% else %}
		                <td></td>
		                {% endif %}
		                {% endautoescape %}
		            </tr>
		        </tbody>
                {% endfor %}
                </table>
                {% endif %}
                </td>
                
            </tr>
            {% endfor %}
        </tbody>
    </table>
        
    <h2 id="grp-admin-title">执行时初始信息</h2>           
    <table class="table table-striped table-bordered table-hover">
        <tbody>
            <tr>
                <td>主机文件内容</td>
                {% autoescape off %}
                <td>{{ report_data.inventory_content }}</td>
                {% endautoescape %}
            </tr>
            
            <tr>
                <td>options</td>
                <td>
	                <table class="table table-striped table-bordered table-hover">
	                {% for title , value in report_data.options.items %}
	                <tbody>
	                    <tr>
	                        {% autoescape off %}
	                        <td>{{ title }}</td>
	                        {% endautoescape %}
	    
	                        {% autoescape off %}
	                        {% if value %}
	                        <td>{{ value }}</td>
	                        {% else %}
	                        <td></td>
	                        {% endif %}
	                        {% endautoescape %}
	                    </tr>
	                </tbody>
	                {% endfor %}
	                </table>
                </td>
            </tr>
        </tbody>
    </table>
    
    
<a href="/ansible/report/"><button type="button" class="btn btn-sm btn-primary" >返回</button></a>
</br>
</br>
</br>
<a href="/ansible/report/detail?uuid={{ report_data.uuid }}&mode={{ report_data.mode }}&force=True"><button type="button" class="btn btn-sm btn-primary" >强制刷新</button></a>
</br>
</br>
</br>
<a href="/ansible/report/detail?uuid={{ report_data.uuid }}&mode={{ report_data.mode }}&force=True&orig_content=True"><button type="button" class="btn btn-sm btn-primary" >查看原文</button></a>
</div>

</br>
</br>
</br>
</br>
{% endblock%}